<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background: #ccc;
            /* position: absolute;
            top: 50%;
            left: 50%; */
            /* transform: translate(-50%, -50%); */
            transform-origin: left top;
            transition: all 1s linear;
            margin: 100px auto;
        }
        #box1:hover {
            background-color: orange;
            /* transform: translate(-50%, -50%); */
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
    <div>
        <div id="box1"></div>
    </div>
</body>
</html>